{% extends 'base.html' %}

{% block title %}
    首页
{% endblock %}

{% block main %}
    <h1 class="text-center">博客列表</h1>
    <div class="row row-cols-2 row-gap-4">
    {% for blog in blogs %}
        <div class="col">
            <div class="card">
                <div class="card-header">
                    <a href="{% url 'blog:blog_detail' blog_id=blog.id %}">{{ blog.title }}.1</a>
                </div>
                <div class="card-body" style="height: 100px">
                    <p class="card-text">
                       {{ blog.content|striptags|truncatechars:200 }}</p>
                </div>
                <div class="card-footer text-body-secondary d-flex justify-content-between">
                    <div>
                        <img src="{% static 'images/可爱蜘蛛侠.png' %}" class="rounded-circle" alt="" height="30">
                        {{ blog.author.username }}
                    </div>
                    <div>
                        发布时间：{{ blog.publish_time|date:"Y-m-d H:i:s" }}
                    </div>
                </div>
            </div>
        </div>
    {% endfor %}
    </div>
    
{% endblock %}